<td class="daynumber
	{% ifequal size "small" %} compact{% endifequal %}
	{% ifnotequal day.start.month month.start.month %} noday"></td>
	{% else %}
		{% if day.is_today %} today
		{% else %}
			{% if day.has_occurrences %} busy
			{% else %} free
		{% endif %}
	{% endif %}">
	<a href="/schedule/calendar/daily/{{ calendar.id }}/{{ day.start.year }}/{{ day.start.month }}/{{ day.start.day }}/"><b>{{day.start.day}}</b></a><br/>
{% comment %} Todo: lotsa code smells in here {% endcomment %} 

{% if day.has_occurrences %}
	{% ifnotequal size "small" %}
		{% for o in day.get_occurrence_partials %}
			{% ifequal o.class 0 %}
				{% if o.occurrence.event.get_first_related_content_object %}
					<a class="pretty" 
						href="{{ o.occurrence.event.get_first_related_content_object.get_absolute_url }}" 
						title="{{ o.occurrence.event.get_first_related_content_object.get_name_display }} of 
							{{ o.occurrence.event.get_first_related_content_object.circle }}
							 - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
						{{ o.occurrence.event.get_first_related_content_object.circle.short_name }} Meeting
					</a>
					<br/>
				{% else %}
					{% ifequal o.occurrence.event.content_type.model "circleevent" %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.circle }} Event: {{ o.occurrence.event.title }} - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.circle.short_name }} {{ o.occurrence.event.title }}
						</a>
						<br/>

					{% else %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.title }} - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.title }}
						</a>
						<br/>
					{% endifequal %}
				{% endif %}
			{% endifequal %}
			{% ifequal o.class 1 %}
				{% if o.occurrence.event.get_first_related_content_object %}
					<a class="pretty" 
						href="{{ o.occurrence.event.get_first_related_content_object.get_absolute_url }}" 
						title="{{ o.occurrence.event.get_first_related_content_object.get_name_display }} of 
							{{ o.occurrence.event.get_first_related_content_object.circle }}
							 - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
						{{ o.occurrence.event.get_first_related_content_object.circle.short_name }} Meeting
					</a>
					<br/>
				{% else %}
					{% ifequal o.occurrence.event.content_type.model "circleevent" %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.circle }} Event: {{ o.occurrence.event.title }} - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.circle.short_name }} {{ o.occurrence.event.title }}
						</a>
						<br/>

					{% else %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.title }} - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.title }}
						</a>
						<br/>
					{% endifequal %}
				{% endif %}
			{% endifequal %}
			{% ifequal o.class 2 %}
				(All day)<br/>
				{% if o.occurrence.event.get_first_related_content_object %}
					<a class="pretty" 
						href="{{ o.occurrence.event.get_first_related_content_object.get_absolute_url }}" 
						title="{{ o.occurrence.event.get_first_related_content_object.get_name_display }} of 
							{{ o.occurrence.event.get_first_related_content_object.circle }}
							 - (All day) at {{ o.occurrence.event.location }}" >
						{{ o.occurrence.event.get_first_related_content_object.circle.short_name }} Meeting
					</a>
					<br/>
				{% else %}
					{% ifequal o.occurrence.event.content_type.model "circleevent" %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.circle }} Event: (All day) - {{ o.occurrence.start|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.circle.short_name }} {{ o.occurrence.event.title }}
						</a>
						<br/>

					{% else %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.title }} - (All day) at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.title }}
						</a>
						<br/>
					{% endifequal %}
				{% endif %}
			{% endifequal %}
			{% ifequal o.class 3 %}
				Ends at {{ o.occurrence.end|time:"P" }} -- 
				{% if o.occurrence.event.get_first_related_content_object %}
					<a class="pretty" 
						href="{{ o.occurrence.event.get_first_related_content_object.get_absolute_url }}" 
						title="{{ o.occurrence.event.get_first_related_content_object.get_name_display }} of 
							{{ o.occurrence.event.get_first_related_content_object.circle }}
							 - Ends at { o.occurrence.end|time:"P" }} at {{ o.occurrence.event.location }}" >
						{{ o.occurrence.event.get_first_related_content_object.circle.short_name }} Meeting
					</a>
					<br/>
				{% else %}
					{% ifequal o.occurrence.event.content_type.model "circleevent" %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.circle }} Event: {{ o.occurrence.event.title }} - Ends at {{ o.occurrence.end|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.circle.short_name }} {{ o.occurrence.event.title }}
						</a>
						<br/>

					{% else %}
						<a class="pretty" href="{{o.occurrence.event.get_absolute_url}}" 
							title="{{ o.occurrence.event.title }} - Ends at {{ o.occurrence.end|time:"P" }} at {{ o.occurrence.event.location }}" >
							{{ o.occurrence.event.title }}
						</a>
						<br/>
					{% endifequal %}
				{% endif %}
			{% endifequal %}
		{% endfor %}
	{% endifnotequal %}
{% endif %}</td>
{% endifnotequal %}